(1) Field of the Invention
The present invention relates to a video signal coding apparatus and video signal coding method for coding a video signal, and particularly relates to a rate controlling technique.
(2) Description of the Related Art
In recent years, digitalization of AV information is advancing, and devices that can handle video signals by digitalization are becoming widely popular. Since the amount of information included in a video signal is large, it is a common practice to perform coding while reducing the amount of information, in consideration of recording capacity and transmission efficiency. An international standard developed by a working group called the Moving Picture Experts Group (MPEG) is widely used as a technique for coding video signals.
Here, H.264 (for example, see Non-Patent Reference 1: ITUT-T H.264 (March 2005): Infrastructure of audiovisual services—Coding of moving video, Advanced video coding for generic audiovisual services, and Non-Patent Reference 2: Okubo et al, H.264/AVC Textbook, Impress Company (2004)) which is a standard for coding methods shall be described using FIG. 7.
FIG. 7 is a block diagram showing the principal configuration of a conventional coding apparatus which performs coding according to H.264.
A coding apparatus 1000 shown in FIG. 7 includes an image sorting unit 1001, a subtractor 1002, an orthogonal transform unit 1003, a quantization unit 1004, a binarization unit 1005, an arithmetic coding unit 1006, a rate control unit 1007, an inverse-quantization unit 1008, an inverse-orthogonal transform unit 1009, an adder 1010, a deblocking filter unit 1011, a frame memory 1012, a motion vector estimation unit 1013, a motion compensation unit 1014, an intra predictive direction estimation unit 1015, an intra prediction unit 1016, and a selection unit 1017.
The image sorting unit 1001 sorts, according to the frame order in the coding order, a video signal which includes a luminance signal and a chrominance signal and is inputted to the coding apparatus 1000, and in addition, partitions the sorted video signal into the units of coding, and outputs the result.
When the luminance signal is to be coded, for example, the image sorting unit 1001 sorts the luminance signal according to the frame order in the coding order, partitions the sorted luminance signal into macroblock—(hereafter denoted as “MB”) units of 16×16 pixels, and outputs the partitioned luminance signal to the subtractor 1002, the intra prediction unit 1016, and the intra predictive direction estimation unit 1015.
The subtractor 1002 generates a residual MB by calculating a difference between the MB outputted by the image sorting unit 1001 and a predictive MB which is generated by the intra prediction unit 1016 or the motion compensation unit 1014 and outputted by the selection unit 1017. Subsequently, the subtractor 1002 outputs the residual MB to the orthogonal transform unit 1003.
The orthogonal transform unit 1003, generates a Discrete Cosine Transform (DCT) coefficient by performing orthogonal transform on the residual MB outputted by the subtractor 1002, and outputs the DCT coefficient to the quantization unit 1004.
The quantization unit 1004 divides the DCT coefficient outputted by the orthogonal transform unit 1003, using a quantization step determined according to a quantization parameter. In addition, the quantization unit 1004 generates a quantized coefficient by rounding-off the result of the division into an integer value, and outputs the quantized coefficient to the binarization unit 1005 and the inverse-quantization unit 1008.
It should be noted that the relationship between the quantization step and a quantization parameter QP in H.264 is set in such a way that that the signal-to-noise ratio (SN ratio) of the coded signal to be outputted by the coding apparatus 1000 and the quantization parameter QP are almost proportional. It should be noted that, when quantization is performed in the quantization unit 1004, the different quantization parameters QP_Y and QP_C are used for a luminance MB and a chrominance MB, respectively.
Here, QP_C is a variable determined based on qP_I calculated using the subsequent equation, and the table shown in FIG. 8, and is a value that is subordinate to QP_Y. For example, when qP_I is calculated to be 51, QP_C is set as 39. Furthermore, when qP_I is a value smaller than 30, QP_C is set as the same value as qP_I.qPI=Clip3(0,51,QPY+qPoffset)  [Math 1]
It should be noted that Clip3(0, 51, x) is a function which returns a value obtained by clipping x using a lower limit 0 and an upper limit 51. Furthermore, qP_Offset is an offset value defined in H.264, which is added to QP_Y. Here, qP_Offset, which is set in the Cb component and the Cr component of a chrominance signal, is expressed in the subsequent manner.qPOffset=chroma—qP_index_offset  [Math 2]qPOffset=second_chroma—qP_index_offset  [Math 3]
It should be noted that chroma_qP_index_offset is an offset value used in the determination of the QP_C corresponding to the Cb component, and adopts a value ranging from −12 to 12. Furthermore, a second_chroma_qP_index_offset is an offset value used in the determination of the QP_C corresponding to the Cr component, and adopts a value ranging from −12 to 12.
The binarization unit 1005 converts, into binary data, the quantized coefficient expressed by multi-value data and outputted by the quantization unit 1004.
The arithmetic coding unit 1006 generates a coded signal, which is the coded video signal, by performing arithmetic coding on the binary data outputted by the binarization unit 1005, and outputs the coded signal to a recording medium connected inside or outside the apparatus. It should be noted that the aforementioned coded signal includes a coded luminance signal obtained by coding the luminance signal, and a coded chrominance signal obtained by coding the chrominance signal.
The rate control unit 1007 is a control unit which changes the setting of the quantization parameter QP to be used in the quantization unit 1004 in order to keep constant the amount of arithmetic code generated by the arithmetic coding unit 1006, while upholding conformance to the aforementioned standard.
Specifically, the rate control unit 1007 changes the setting of the quantization parameter QP by using the amount of binary code outputted by the binarization unit 1005 and the amount of arithmetic code outputted by the arithmetic coding unit 1006.
A method of performing rate control using the relationship between the binary code amount and the arithmetic code amount in the rate control unit 1007 is disclosed, for example, in Patent Reference 1 (Japanese Unexamined Patent Application Publication No. 2007-158430). In the method disclosed in Patent Reference 1, an estimate arithmetic code amount of a current picture is obtained from the relationship of a past binary code amount and arithmetic code amount, and the quantization parameter is determined by assuming the estimate arithmetic code amount to be the generated code amount for the current picture.
Furthermore, the method below is available as a method of determining the quantization parameter QP from the estimate arithmetic code amount, that is, the generated code amount for each picture. In this method, the allocated code amount T for each picture type is calculated under a condition that (complexity)=(picture generated code amount)×(inter-picture average quantization step) is constant for the same scene. In addition, an accumulated amount d in a virtual buffer is calculated using the difference between such allocated code amount T and an actual generated code amount B, and the quantization parameter is determined based on this accumulated amount d.
The inverse-quantization unit 1008 restores the quantized coefficient outputted by the quantization unit 1004 to the DCT coefficient, by performing inverse-quantization on the quantized coefficient, and outputs the DCT coefficient to the inverse-orthogonal transform unit 1009.
The inverse-orthogonal transform unit 1009 restores the DCT coefficient outputted by the inverse-quantization unit 1008 to the residual MB by performing inverse-orthogonal transform on the DCT coefficient, and outputs the residual MB to the adder 1010.
The adder 1010 generates a decoded MB by adding the residual MB outputted by the inverse-orthogonal transform unit 1009 and the predictive MB, which is generated by the intra prediction unit 1016 or the motion compensation unit 1014, that is outputted by the selection unit 1017, and outputs the decoded MB to the deblocking filter unit 1011, the intra predictive direction estimation unit 1015, and the intra prediction unit 1016.
The deblocking filter unit 1011 performs deblocking filtering on the MB boundaries in the decoded MBs outputted by the adder 1010, and outputs the result to the frame memory 1012.
The frame memory 1012 accumulates the decoded MB outputted by deblocking filter unit 1011. The frame memory 1012 is implemented using a recording medium such as a flash memory, a DRAM, or a ferroelectric memory.
The motion vector estimation unit 1013 estimates the motion vector for the decoded MB accumulated in the frame memory 1012, based on the current MB to be coded. It should be noted that, in the case of the H.264 standard, seven types of processing sizes are defined for the processing size of the MB to be processed by the motion vector estimation unit 1013. The motion vector estimation unit 1013 selects one from these seven types, for each MB.
The motion compensation unit 1014 generates a predictive MB by performing motion compensation on the decoded MB accumulated in the frame memory 1012, based on the motion vector estimated by the motion vector estimation unit 1013
The intra predictive direction estimation unit 1015 estimates the prediction mode to be applied in the intra prediction, based on the decoded MB outputted by the adder 1010 and the MB outputted by the image sorting unit 1001. Subsequently, the intra predictive direction estimation unit 1015 outputs information indicating the estimated prediction mode to the intra prediction unit 1016.
The intra prediction unit 1016 generates a predictive MB by performing intra prediction on the decoded MB outputted by the adder 1010. Subsequently, the intra prediction unit 1016 outputs the generated predictive MB to the selection unit 1017.
The selection unit 1017 selects one predictive MB out of the predictive MBs outputted respectively by the intra prediction unit 1016 and the motion compensation unit 1014, and outputs the selected predictive MB to the subtractor 1002.
The rate control unit 1007 of the conventional coding apparatus 1000 configured in the above-described manner uses a rate control method which makes use of the property in which the product of the quantization step and the code amount of the video signal outputted by the coding apparatus 1000 is constant for the same scene.